//
//  MQSeallCenterViewController.m
//  meiquan
//
//  Created by hejingjin on 2017/10/21.
//  Copyright © 2017年 mq. All rights reserved.
//

#import "MQSeallCenterViewController.h"
#import "MQSealCenterview.h"
#import "ApplicationButton.h"
#import "MQMyProductViewController.h"
#import "MQMyAruthViewController.h"
#import "MQOrderManagerViewController.h"
#import "MQSendProductViewController.h"
#import "MQMyCustomsViewController.h"
#import "MQApplyagentViewController.h"
#import "MQAgentAruthViewController.h"


@interface MQSeallCenterViewController ()

@property(nonatomic,strong)NSArray *firesttitlearray;
@property(nonatomic,strong)NSArray *firsticonarray;


@property(nonatomic,strong)NSArray *secendtitlearray;
@property(nonatomic,strong)NSArray *secendiconarray;

@property(nonatomic,strong)UIScrollView *bgscrollview;

@end

@implementation MQSeallCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.title = @"卖家中心";
    
    _firesttitlearray = @[@"申请代理",@"邀请代理",@"加入新品",@"我的商品",@"我的授权",@"发货扫单",@"我的发货",@"订单管理"];
    _firsticonarray = @[@"maijia_shengqingdl",@"maijia_yaoqingdl",@"maijia_jiaruxp",@"maijia_wodesp",@"maijia_wodesq",@"maijia_fahuosd",@"maijia_woyaofh",@"maajia_dingdangl"];
//    
    _secendtitlearray = @[@"收入报表",@"客户资料",@"客户分析",@"下单提醒",@"生日提醒",@"一键发圈",@"图文素材",@"订单导出",@"订单导入",@"客服帮助"];
    _secendiconarray = @[@"maijia_shangrubb",@"maijia_kehuzl",@"maijia_kehufx",@"maijia_xiadantx",@"maijia_shangritx",@"maijia_yijianfq",@"maijia_tuwensc",@"maijia_dingdandr",@"maijia_dingdandc",@"maijia_kefubz"];
    
    [self setUpMainInterface];
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)setUpMainInterface{
    
    self.view.backgroundColor = BSTColorFromRGB(0xefefef);
    
    _bgscrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, BSTScreenW, BSTScreenH)];
    
    MQSealCenterview *topview = [MQSealCenterview mQSealCenterview];
    topview.bst_x = 0;
    topview.bst_y = 0;
    topview.bst_height = 180 *Persion;
    topview.bst_width = BSTScreenW;
//    [self.view addSubview:topview];
    [_bgscrollview addSubview:topview];
    
    
    UIView *firstview = [[UIView alloc] initWithFrame:CGRectMake(0, MAX_Y(topview.frame) + 10, BSTScreenW, 205 * Persion)];
    firstview.backgroundColor = [UIColor whiteColor];
    
    for (int i = 0; i < 8; i++) {
        ApplicationButton *button = [ApplicationButton applicationButton];
        NSInteger col = i/4;
        NSInteger row = i%4;
        button.bst_x = 27 * Persion + row * (90 * Persion);
        button.bst_y =  col *110 + 15 * Persion;
        button.bst_width = 50 * Persion;
        button.bst_height =  70 * Persion;
        button.applicationLabels.text = _firesttitlearray[i];
        button.buttons.tag = 10000 + i;
        [button.buttons addTarget:self action:@selector(buttonsPressed:) forControlEvents:UIControlEventTouchUpInside];
        button.iconimageview.image = [UIImage imageNamed:_firsticonarray[i]];
        [firstview addSubview:button];
        
    }
    
//    [self.view addSubview:firstview];
    [_bgscrollview addSubview:firstview];
    
    
    
    UIView *secendview = [[UIView alloc] initWithFrame:CGRectMake(0, MAX_Y(firstview.frame) + 10, BSTScreenW, 310 * Persion)];
    secendview.backgroundColor = [UIColor whiteColor];
    
    for (int i = 0; i < 10; i++) {
        ApplicationButton *button = [ApplicationButton applicationButton];
        NSInteger col = i/4;
        NSInteger row = i%4;
        button.bst_x = 27 * Persion + row * (90 * Persion);
        button.bst_y =  col *110 + 15 * Persion;
        button.bst_width = 50 * Persion;
        button.bst_height =  70 * Persion;
        button.buttons.tag = 20000 +i;
        button.applicationLabels.text = _secendtitlearray[i];
        button.iconimageview.image = [UIImage imageNamed:_secendiconarray[i]];
        [button.buttons addTarget:self action:@selector(buttonsPresseds:) forControlEvents:UIControlEventTouchUpInside];
//        button.iconimageview.image = [UIImage imageNamed:_secendiconarray[i]];
        [secendview addSubview:button];
        
    }
    
//    [self.view addSubview:secendview];
    [_bgscrollview addSubview:secendview];
    
    
    [_bgscrollview setContentSize:CGSizeMake(BSTScreenW, MAX_Y(secendview.frame) + 20)];
    
    [self.view addSubview:_bgscrollview];
    
}

-(void)buttonsPressed:(UIButton *)sender{
    
    
    NSInteger index = sender.tag - 10000;
    
    switch (index) {
        case 0:
        {
            MQApplyagentViewController *applyagentvc = [[MQApplyagentViewController alloc] init];
            [self.navigationController pushViewController:applyagentvc animated:YES];
        }
            
            break;
        case 1:
        {
            MQAgentAruthViewController *agentaruthvc = [[MQAgentAruthViewController alloc] init];
            
            [self.navigationController pushViewController:agentaruthvc animated:YES];
            
        }
            
            break;
        case 2:
            
            break;
        case 3:
        {
            MQMyProductViewController *myproductvc = [[MQMyProductViewController alloc] init];
            
            [self.navigationController pushViewController:myproductvc animated:YES];
            
        }
            break;
        case 4:
        {
            //我的授权
            MQMyAruthViewController *myaruthvc = [[MQMyAruthViewController alloc] init];
            
            [self.navigationController pushViewController:myaruthvc animated:YES];
        }
            
            break;
        case 5:
            
            break;
        case 6:
        {
            MQSendProductViewController *sendprodctvc = [[MQSendProductViewController alloc] init];
            
            [self.navigationController pushViewController:sendprodctvc animated:YES];
        }
            break;
        case 7:
        {
            MQOrderManagerViewController *ordermanagervc = [[MQOrderManagerViewController alloc] init];
            [self.navigationController pushViewController:ordermanagervc animated:YES];
        }
            break;
            
        default:
            break;
    }
    
    
    
    
}
//第二组button
-(void)buttonsPresseds:(UIButton *)sender{
    NSInteger index = sender.tag - 20000;
    
    switch (index) {
        case 0:
        {
      
        }
            break;
        case 1:
        {
            MQMyCustomsViewController *mycustomvc = [[MQMyCustomsViewController alloc] init];
            [self.navigationController pushViewController:mycustomvc animated:YES];
        }
            
            break;
        case 2:
     
            break;
        case 3:
        {
     
            
        }
            break;
        case 4:
        {
           
        }
            
            break;
        case 5:
            
            break;
        case 6:
        {
            
        }
            break;
        case 7:
        {
           
        }
            break;
        case 8:
        {
            
        }
            break;
        case 9:
        {
            
        }
            break;
            
        default:
            break;
    }
}

@end
